#pragma once

class ArbitrageContracts
{
public:
	ArbitrageContracts(int major, int minor)
		:m_major(major),m_minor(minor)
	{
		m_farther = max(major,minor);
		m_nearby = min(major,minor);
	}

	ArbitrageContracts(ArbitrageContracts const& other)
		:m_major(other.GetMajor()),m_minor(other.GetMinor()),m_farther(other.GetFarther()),m_nearby(other.GetNearby())
	{

	}

	ArbitrageContracts& operator=(ArbitrageContracts const& other)
	{
		m_major = other.GetMajor();
		m_minor = other.GetMinor();
		m_farther = other.GetFarther();
		m_nearby = other.GetNearby();
		return *this;
	}

	bool operator<(ArbitrageContracts const& other) const
	{
		if (m_farther < other.m_farther)
		{
			return true;
		}
		else if (m_farther == other.m_farther)
		{
			return m_nearby < other.m_nearby;
		}
		return false;
	}

	bool operator==(ArbitrageContracts const& other) const
	{
		return m_farther == other.m_farther && m_nearby == other.m_nearby;
	}
	bool operator!=(ArbitrageContracts const& other) const
	{
		return !operator==(other);
	}
	int GetMajor() const {return m_major;}
	int GetMinor() const {return m_minor;}
	int GetFarther() const {return m_farther;}
	int GetNearby() const {return m_nearby;}

	bool IsMajorEqualFarther() const { return m_major == m_farther; }
	bool Included(int contract) const { return m_major == contract || m_minor == contract;}
private:
	int m_major;
	int m_minor;
	int m_farther;
	int m_nearby;
};

